CHAPTER 19 Other Useful Kinds of Regression 283
closer estimates to the truth, repeating this process until it arrives at the
best-fitting, least-squares solution.
Coming up with starting estimates for nonlinear regression problems can be
tricky. It’s more of an art than a science. If the parameters have physiological
meaning, you may be able to make a guess based on known physiology or past
experience. Other times, your estimates have to be trial and error. To improve
your estimates, you can graph your observed data in Microsoft Excel, and then
superimpose a curve from values calculated from the function for various
parameter guesses that you type in. That way, you can play around with the
parameters until the curve is at least in the ballpark of the observed data.
In this example, C0 (variable C0) is the concentration you expect at the moment
of dosing (at t 0). From Figure 19-6, it looks like the concentration starts out
around 50, so you can use 50 as an initial guess for C0. The ke parameter (variable
ke) affects how quickly the concentration decreases with time. Figure 19-6
indicates that the concentration seems to decrease by half about every few
hours, so λ should be somewhere around 4 hours. Because
0 693
.
/ ke,
a little algebra gives the equation ke = 0.693/X. If you plug in 4 hours for X, you
get ke = 0.693/4 = 0.2, so you may try 0.2 as a starting guess for ke. You tell
R the starting guesses by using the syntax: start=list(C0
50, ke
0.2).
The statement in R for nonlinear regression is nls, which stands for nonlinear
least-squares. The full R statement for executing this nonlinear regression model
and summarizing the output is:
summary nls Conc
C0 exp
ke Time
start
list C0
50
*
*
,
,
ke
0.2
Interpreting the output
As complicated as nonlinear curve-fitting may be, the output is actually quite
simple. It is formatted and interpreted like the output from ordinary linear regres-
sion. Figure 19-7 shows the relevant part of R’s output for this example.
FIGURE 19-7:
Results of
nonlinear
regression in R.